package com.qfedu.dao.impl;

import com.qfedu.bean.User;
import com.qfedu.dao.InsertDao;
import com.qfedu.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class InseretDaoImpl implements InsertDao {
    @Override
    public User insert(User inputUser) throws Exception {

        return new QueryRunner(JDBCUtils.getDatasource()).insert("insert into tb_user (username,password) values (?,?) ",
        new BeanHandler<User>(User.class),
        inputUser.getUsername(),
        inputUser.getPassword());
    }
}
